//
//  NewsInfoViewController.m
//  idoctor
//
//  Created by Mr Lee on 2017/6/1.
//  Copyright © 2017年 Mr Lee. All rights reserved.
//

#define newInfo @"http://www.tngou.net/api/info/show?"

#import "NewsInfoViewController.h"
#import <WebKit/WebKit.h>

@interface NewsInfoViewController ()
{
    NSMutableDictionary *_infoDict;
    
    
}

@property(nonatomic,strong)WKWebView *infoWebView;
@end

@implementation NewsInfoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self initUI];
    
    [self loadInfo];
}

-(void)initUI
{

    self.navigationItem.title = @"资讯详情";
    
    _infoWebView = [[WKWebView alloc]initWithFrame:self.view.bounds];
  
    [self.view addSubview:_infoWebView];

}

-(void)loadInfo
{
    
    _infoDict = [NSMutableDictionary dictionary];
    
    [_infoDict setObject:_newsId forKey:@"id"];
    
    [SVProgressHUD showWithStatus:@"加载中"];

    [[HttpRequest shardWebUtil]getNetworkRequestURLString:newInfo parameters:_infoDict success:^(id obj)
    {
        
        [SVProgressHUD dismiss];
        
        
        NSString *htmlStr = obj[@"message"];
        
        [_infoWebView loadHTMLString:htmlStr baseURL:nil];
        
        
        
    } fail:^(NSError *error) {
        
    }];
    
}

-(void)viewWillDisappear:(BOOL)animated
{

    [SVProgressHUD dismiss];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
